//  导入防抖函数方法
import { debounce } from './antiShake'
//  回到顶部功能小组件
import BackTop from 'components/content/backTop/BackTop'

// 混入对象
const itemListenerMixin = {
    data() {
      return {
        itemImgListener: null,
        refresh: null
        }
    },
   mounted() {
      this.refresh = debounce(this.$refs.scrolldata.refresh, 180)
      this.itemImgListener = () => {
        this.refresh()
    }
    this.$bus.$on('itemImagesLoad', this.itemImgListener)
    //  console.log('混入');
   }
}

const backTopMixin = {
     components: {
      BackTop
     },
     data() {
       return {
         activebackTop: false,    //  BackTop button 当前隐藏
       }
     },
     methods: {
      backClick() {
        this.$refs.scrolldata.scrollTo(0, 0, 600);
      },
      btnYingChang (weizi) {
        this.activebackTop = (-weizi.y) >1200
      }
     }
}
export {
  itemListenerMixin,
  backTopMixin
}